package org.example.design.factory;

import org.example.design.factory.itf.Commodity;
import org.example.design.factory.itf.impl.CardCommdityService;
import org.example.design.factory.itf.impl.CounponCommdityService;
import org.example.design.factory.itf.impl.GoodCommdityServie;

/**
 * @Classname StoryFactory
 * @Description 发放奖励工厂类
 * @Date 2020/10/30 11:39 上午
 * @Created by xiangjd
 */
public class StoryFactory {

    public Commodity getCommodityService(Integer type) {
        if (null == type) {
            return null;
        }
        if (1 == type) {
            return new CounponCommdityService();
        }
        if (2 == type) {
            return new GoodCommdityServie();
        }
        if (3 == type) {
            return new CardCommdityService();
        }
        throw new RuntimeException("不存在的商品服务类型");
    }
}
